package com.heima.user.controller.v1;

import com.heima.model.user.dtos.LikesDto;
import com.heima.model.user.dtos.ReadDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.user.service.UserBehaviorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ybw
 * @version 1.0
 * @date 2021/12/22 15:31
 */
@RestController
@RequestMapping("/api/v1")
public class UserBehaviorController {
  @Autowired private UserBehaviorService userBehaviorService;

  /**
   * 用户点赞行为
   *
   * @param dto
   * @return
   */
  @PostMapping("/likes_behavior")
  public ResponseResult likeBehavior(@RequestBody LikesDto dto) {
    return userBehaviorService.likeBehavior(dto);
  }

  /**
   * 用户阅读行为
   *
   * @return
   */
  @PostMapping("/read_behavior")
  public ResponseResult readBehavior(@RequestBody ReadDto dto) {
    return userBehaviorService.readBehavior(dto);
  }

  /**
   * 用户不喜欢
   * @param dto
   * @return
   */
  @PostMapping("/un_likes_behavior")
  public ResponseResult unlikeBehavior(@RequestBody LikesDto dto){
    return userBehaviorService.unlikeBehavior(dto);
  }

}
